package com.shop2cn.iapi.couponmanage.testcase;

import java.util.*;
import java.util.stream.Collectors;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.shop2cn.iapi.couponmanage.parameter.*;
import com.shop2cn.iapi.couponmanage.service.*;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.CouponShop2cnMCallService;
import com.ymttest.database.model.CouponShop2cn.couponbatch;
import com.ymttest.database.model.CouponShop2cn.couponusecondition;
import com.ymttest.database.sqlwapper.CouponShop2cn.couponbatchWapper;
import com.ymttest.database.sqlwapper.CouponShop2cn.couponuseconditionWapper;
import com.ymttest.utils.TestDataManager;
/**
*修改商家端优惠券使用条件
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_ChangeUseCondition{
	private static ChangeUseCondition2Bean changeuseconditionBean;
	private static ChangeUseCondition2Call changeuseconditionCall;
	CouponShop2cnMCallService CouponShop2cnMCallService;
	couponbatchWapper couponbatchWapper;
	couponuseconditionWapper couponuseconditionWapper;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("修改商家端优惠券使用条件");
	}

	@Before
	public void caseUp() {
		changeuseconditionBean=new ChangeUseCondition2Bean();
		changeuseconditionCall=new ChangeUseCondition2Call();
		CouponShop2cnMCallService=new CouponShop2cnMCallService();
		couponbatchWapper=new couponbatchWapper();
		 couponuseconditionWapper=new couponuseconditionWapper();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(changeuseconditionCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	private void VerifyDb(String batchCode, ChangeUseCondition2Bean changeuseconditionBean2) {
		couponbatch batch = couponbatchWapper.selectBybatchCode(batchCode).get(0);
		Logger.verifyEquals(changeuseconditionBean2.getUseConditionType(),batch.getUseConditionType(),"验证UseConditionType");
		if(changeuseconditionBean2.getUseConditionType().equals(1)) {
			List<couponusecondition> userLst=couponuseconditionWapper.selectByBatchId(batch.getBatchId());
			Logger.verifyEquals(1, userLst.size(), "UseConditionType1只有1条");
			Logger.verifyEquals(changeuseconditionBean2.getSellerId().toString(),userLst.get(0).getConditionValue(),"验证ConditionValue");
		}else if(changeuseconditionBean2.getUseConditionType().equals(2)&&changeuseconditionBean2.getProductIdList()!=null&&changeuseconditionBean2.getProductIdList().size()>0) {
			List<couponusecondition> userLst=couponuseconditionWapper.selectByBatchId(batch.getBatchId());
			List newProductIdList = changeuseconditionBean2.getProductIdList().stream().distinct().filter(x -> x!=null).collect(Collectors.toList()); 
			Logger.verifyEquals(newProductIdList.size(), userLst.size(), "UseConditionType2条数");
			List<String> pl=userLst.stream().map(mapper->{return mapper.getConditionValue();}).collect(Collectors.toList());
			changeuseconditionBean2.getProductIdList().forEach(p->{
				if(p!=null&&p.trim().length()>0) {
					Logger.verifyEquals(true, pl.contains(p), "验证商品数据包含");
				}
			});
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_ChangeUseCondition_001() {
		Logger.start(true,"修改商家端优惠券使用条件,指定商品修改为全店通用成功");
		try {
			SellerCreateBatchBean sellercreatebatchBean = CouponShop2cnMCallService.setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCurrency("CNY");
			sellercreatebatchBean.setUseConditionType(2);
			List<String> pIdStrings=new ArrayList();
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			sellercreatebatchBean.setproductIdList(pIdStrings);

			String batchCode1 = CouponShop2cnMCallService.SellerCreateBatch(sellercreatebatchBean).getBatchCode();
			List<couponbatch> list = couponbatchWapper.selectBybatchCode(batchCode1);
			changeuseconditionBean.setBatchId(list.get(0).getBatchId());
			changeuseconditionBean.setUseConditionType(1);
			changeuseconditionBean.setSellerId(sellercreatebatchBean.getSellerId());
			changeuseconditionBean.setProductIdList(null);
			changeuseconditionCall.setData(changeuseconditionBean);
			changeuseconditionCall.callService();		
			Logger.verifyEquals("0", changeuseconditionCall.getString("statusCode"), "验证statusCode");
			
			VerifyDb(batchCode1,changeuseconditionBean);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	

	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_ChangeUseCondition_002() {
		Logger.start(true,"修改商家端优惠券使用条件,全店通用修改为指定商品成功");
		try {
			SellerCreateBatchBean sellercreatebatchBean = CouponShop2cnMCallService.setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCurrency("CNY");
			sellercreatebatchBean.setUseConditionType(1);
			List<String> pIdStrings=new ArrayList();
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
//			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
//			sellercreatebatchBean.setproductIdList(pIdStrings);

			String batchCode1 = CouponShop2cnMCallService.SellerCreateBatch(sellercreatebatchBean).getBatchCode();
			List<couponbatch> list = couponbatchWapper.selectBybatchCode(batchCode1);
			changeuseconditionBean.setBatchId(list.get(0).getBatchId());
			changeuseconditionBean.setUseConditionType(2);
			changeuseconditionBean.setSellerId(sellercreatebatchBean.getSellerId());
			changeuseconditionBean.setProductIdList(pIdStrings);
			changeuseconditionCall.setData(changeuseconditionBean);
			changeuseconditionCall.callService();		
			Logger.verifyEquals("0", changeuseconditionCall.getString("statusCode"), "验证statusCode");
			
			VerifyDb(batchCode1,changeuseconditionBean);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_ChangeUseCondition_003() {
		Logger.start(true,"修改商家端优惠券使用条件,多个指定商品成功");
		try {
			SellerCreateBatchBean sellercreatebatchBean = CouponShop2cnMCallService.setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCurrency("CNY");
			sellercreatebatchBean.setUseConditionType(1);
			List<String> pIdStrings=new ArrayList();
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
//			sellercreatebatchBean.setproductIdList(pIdStrings);

			String batchCode1 = CouponShop2cnMCallService.SellerCreateBatch(sellercreatebatchBean).getBatchCode();
			List<couponbatch> list = couponbatchWapper.selectBybatchCode(batchCode1);
			changeuseconditionBean.setBatchId(list.get(0).getBatchId());
			changeuseconditionBean.setUseConditionType(2);
			changeuseconditionBean.setSellerId(sellercreatebatchBean.getSellerId());
			changeuseconditionBean.setProductIdList(pIdStrings);
			changeuseconditionCall.setData(changeuseconditionBean);
			changeuseconditionCall.callService();		
			Logger.verifyEquals("0", changeuseconditionCall.getString("statusCode"), "验证statusCode");
			
			VerifyDb(batchCode1,changeuseconditionBean);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_ChangeUseCondition_004() {
		Logger.start(true,"修改商家端优惠券使用条件,不输入sellerId失败");
		try {
			List<String> pIdStrings=new ArrayList();
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			changeuseconditionBean.setBatchId(1);
			changeuseconditionBean.setUseConditionType(1);
//			changeuseconditionBean.setSellerId(1);
			changeuseconditionBean.setProductIdList(pIdStrings);
			changeuseconditionCall.setData(changeuseconditionBean);
			changeuseconditionCall.callService();		
			Logger.verifyEquals("1", changeuseconditionCall.getString("statusCode"), "验证statusCode");
			Logger.verifyEquals(1, changeuseconditionCall.getJsonObject().get("data").getAsJsonObject().get("errorCode").getAsInt(), "验证errorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_ChangeUseCondition_005() {
		Logger.start(true,"修改商家端优惠券使用条件,不输入batchId失败");
		try {
			List<String> pIdStrings=new ArrayList();
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
//			changeuseconditionBean.setBatchId(1);
			changeuseconditionBean.setUseConditionType(1);
			changeuseconditionBean.setSellerId(1);
			changeuseconditionBean.setProductIdList(pIdStrings);
			changeuseconditionCall.setData(changeuseconditionBean);
			changeuseconditionCall.callService();		
			Logger.verifyEquals("1", changeuseconditionCall.getString("statusCode"), "验证statusCode");
			Logger.verifyEquals(1, changeuseconditionCall.getJsonObject().get("data").getAsJsonObject().get("errorCode").getAsInt(), "验证errorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_ChangeUseCondition_006() {
		Logger.start(true,"修改商家端优惠券使用条件,不输入useConditionType失败");
		try {
			List<String> pIdStrings=new ArrayList();
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			changeuseconditionBean.setBatchId(1);
//			changeuseconditionBean.setUseConditionType(1);
			changeuseconditionBean.setSellerId(1);
			changeuseconditionBean.setProductIdList(pIdStrings);
			changeuseconditionCall.setData(changeuseconditionBean);
			changeuseconditionCall.callService();		
			Logger.verifyEquals("1", changeuseconditionCall.getString("statusCode"), "验证statusCode");
			Logger.verifyEquals(1, changeuseconditionCall.getJsonObject().get("data").getAsJsonObject().get("errorCode").getAsInt(), "验证errorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_ChangeUseCondition_007() {
		Logger.start(true,"修改商家端优惠券使用条件,useConditionType为2时不输入productIdList失败");
		try {
			List<String> pIdStrings=new ArrayList();
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			changeuseconditionBean.setBatchId(1);
			changeuseconditionBean.setUseConditionType(2);
			changeuseconditionBean.setSellerId(1);
//			changeuseconditionBean.setProductIdList(pIdStrings);
			changeuseconditionCall.setData(changeuseconditionBean);
			changeuseconditionCall.callService();		
			Logger.verifyEquals("2", changeuseconditionCall.getString("statusCode"), "验证statusCode");
			Logger.verifyEquals(2, changeuseconditionCall.getJsonObject().get("data").getAsJsonObject().get("errorCode").getAsInt(), "验证errorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_ChangeUseCondition_008() {
		Logger.start(true,"修改商家端优惠券使用条件,修改全店通用后再修改为指定商品成功");
		try {
			SellerCreateBatchBean sellercreatebatchBean = CouponShop2cnMCallService.setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCurrency("CNY");
			sellercreatebatchBean.setUseConditionType(2);
			List<String> pIdStrings=new ArrayList();
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			sellercreatebatchBean.setproductIdList(pIdStrings);

			String batchCode1 = CouponShop2cnMCallService.SellerCreateBatch(sellercreatebatchBean).getBatchCode();
			List<couponbatch> list = couponbatchWapper.selectBybatchCode(batchCode1);
			changeuseconditionBean.setBatchId(list.get(0).getBatchId());
			changeuseconditionBean.setUseConditionType(1);
			changeuseconditionBean.setSellerId(sellercreatebatchBean.getSellerId());
			changeuseconditionBean.setProductIdList(null);
			changeuseconditionCall.setData(changeuseconditionBean);
			changeuseconditionCall.callService();		
			Logger.verifyEquals("0", changeuseconditionCall.getString("statusCode"), "验证statusCode");
			
			VerifyDb(batchCode1,changeuseconditionBean);
			
			List<String> pIdStrings2=new ArrayList();
			pIdStrings2.add("p"+TestDataManager.getRandomIntNum(5));
			pIdStrings2.add("p"+TestDataManager.getRandomIntNum(5));
			
			changeuseconditionBean.setBatchId(list.get(0).getBatchId());
			changeuseconditionBean.setUseConditionType(2);
			changeuseconditionBean.setSellerId(sellercreatebatchBean.getSellerId());
			changeuseconditionBean.setProductIdList(pIdStrings2);
			changeuseconditionCall.setData(changeuseconditionBean);
			changeuseconditionCall.callService();		
			Logger.verifyEquals("0", changeuseconditionCall.getString("statusCode"), "验证statusCode");
			
			VerifyDb(batchCode1,changeuseconditionBean);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_ChangeUseCondition_009() {
		Logger.start(true,"修改商家端优惠券使用条件,修改指定商品后再修改为全店通用成功");
		try {
			SellerCreateBatchBean sellercreatebatchBean = CouponShop2cnMCallService.setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCurrency("CNY");
			sellercreatebatchBean.setUseConditionType(1);
			List<String> pIdStrings=new ArrayList();
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
//			sellercreatebatchBean.setproductIdList(pIdStrings);

			String batchCode1 = CouponShop2cnMCallService.SellerCreateBatch(sellercreatebatchBean).getBatchCode();
			List<couponbatch> list = couponbatchWapper.selectBybatchCode(batchCode1);
			changeuseconditionBean.setBatchId(list.get(0).getBatchId());
			changeuseconditionBean.setUseConditionType(2);
			changeuseconditionBean.setSellerId(sellercreatebatchBean.getSellerId());
			changeuseconditionBean.setProductIdList(pIdStrings);
			changeuseconditionCall.setData(changeuseconditionBean);
			changeuseconditionCall.callService();		
			Logger.verifyEquals("0", changeuseconditionCall.getString("statusCode"), "验证statusCode");
			
			VerifyDb(batchCode1,changeuseconditionBean);
			
			
			changeuseconditionBean.setBatchId(list.get(0).getBatchId());
			changeuseconditionBean.setUseConditionType(1);
			changeuseconditionBean.setSellerId(sellercreatebatchBean.getSellerId());
			changeuseconditionBean.setProductIdList(null);
			changeuseconditionCall.setData(changeuseconditionBean);
			changeuseconditionCall.callService();		
			Logger.verifyEquals("0", changeuseconditionCall.getString("statusCode"), "验证statusCode");
			
			VerifyDb(batchCode1,changeuseconditionBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_ChangeUseCondition_010() {
		Logger.start(true,"修改商家端优惠券使用条件,指定商品后修改为指定商品,商品发生变化,成功");
		try {
			SellerCreateBatchBean sellercreatebatchBean = CouponShop2cnMCallService.setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCurrency("CNY");
			sellercreatebatchBean.setUseConditionType(1);
			List<String> pIdStrings=new ArrayList();
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
//			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
//			sellercreatebatchBean.setproductIdList(pIdStrings);

			String batchCode1 = CouponShop2cnMCallService.SellerCreateBatch(sellercreatebatchBean).getBatchCode();
			List<couponbatch> list = couponbatchWapper.selectBybatchCode(batchCode1);
			changeuseconditionBean.setBatchId(list.get(0).getBatchId());
			changeuseconditionBean.setUseConditionType(2);
			changeuseconditionBean.setSellerId(sellercreatebatchBean.getSellerId());
			changeuseconditionBean.setProductIdList(pIdStrings);
			changeuseconditionCall.setData(changeuseconditionBean);
			changeuseconditionCall.callService();		
			Logger.verifyEquals("0", changeuseconditionCall.getString("statusCode"), "验证statusCode");
			
			VerifyDb(batchCode1,changeuseconditionBean);
			
			List<String> pIdStrings2=new ArrayList();
			pIdStrings2.add("p"+TestDataManager.getRandomIntNum(5));
			pIdStrings2.add("p"+TestDataManager.getRandomIntNum(5));
			
			changeuseconditionBean.setBatchId(list.get(0).getBatchId());
			changeuseconditionBean.setUseConditionType(2);
			changeuseconditionBean.setSellerId(sellercreatebatchBean.getSellerId());
			changeuseconditionBean.setProductIdList(pIdStrings2);
			changeuseconditionCall.setData(changeuseconditionBean);
			changeuseconditionCall.callService();		
			Logger.verifyEquals("0", changeuseconditionCall.getString("statusCode"), "验证statusCode");
			
			VerifyDb(batchCode1,changeuseconditionBean);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_ChangeUseCondition_011() {
		Logger.start(true,"修改商家端优惠券使用条件,全店通用并且传入多个productId,数据正确");
		try {
			SellerCreateBatchBean sellercreatebatchBean = CouponShop2cnMCallService.setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCurrency("CNY");
			sellercreatebatchBean.setUseConditionType(2);
			List<String> pIdStrings=new ArrayList();
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			sellercreatebatchBean.setproductIdList(pIdStrings);

			String batchCode1 = CouponShop2cnMCallService.SellerCreateBatch(sellercreatebatchBean).getBatchCode();
			List<couponbatch> list = couponbatchWapper.selectBybatchCode(batchCode1);
			changeuseconditionBean.setBatchId(list.get(0).getBatchId());
			changeuseconditionBean.setUseConditionType(1);
			changeuseconditionBean.setSellerId(sellercreatebatchBean.getSellerId());
			changeuseconditionBean.setProductIdList(pIdStrings);
			changeuseconditionCall.setData(changeuseconditionBean);
			changeuseconditionCall.callService();		
			Logger.verifyEquals("0", changeuseconditionCall.getString("statusCode"), "验证statusCode");
			
			VerifyDb(batchCode1,changeuseconditionBean);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_ChangeUseCondition_012() {
		Logger.start(true,"修改商家端优惠券使用条件,全店通用修改为指定商品成功-商品pid重复");
		try {
			SellerCreateBatchBean sellercreatebatchBean = CouponShop2cnMCallService.setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCurrency("CNY");
			sellercreatebatchBean.setUseConditionType(1);
			List<String> pIdStrings=new ArrayList();
			String p="p"+TestDataManager.getRandomIntNum(5);
			pIdStrings.add(p);
			pIdStrings.add(p);
//			sellercreatebatchBean.setproductIdList(pIdStrings);

			String batchCode1 = CouponShop2cnMCallService.SellerCreateBatch(sellercreatebatchBean).getBatchCode();
			List<couponbatch> list = couponbatchWapper.selectBybatchCode(batchCode1);
			changeuseconditionBean.setBatchId(list.get(0).getBatchId());
			changeuseconditionBean.setUseConditionType(2);
			changeuseconditionBean.setSellerId(sellercreatebatchBean.getSellerId());
			changeuseconditionBean.setProductIdList(pIdStrings);
			changeuseconditionCall.setData(changeuseconditionBean);
			changeuseconditionCall.callService();		
			Logger.verifyEquals("0", changeuseconditionCall.getString("statusCode"), "验证statusCode");
			
			VerifyDb(batchCode1,changeuseconditionBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_ChangeUseCondition_013() {
		Logger.start(true,"修改商家端优惠券使用条件,全店通用修改为指定商品成功-pid为空");
		try {
			SellerCreateBatchBean sellercreatebatchBean = CouponShop2cnMCallService.setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCurrency("CNY");
			sellercreatebatchBean.setUseConditionType(1);
			List<String> pIdStrings=new ArrayList();
			pIdStrings.add(null);
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
//			sellercreatebatchBean.setproductIdList(pIdStrings);

			String batchCode1 = CouponShop2cnMCallService.SellerCreateBatch(sellercreatebatchBean).getBatchCode();
			List<couponbatch> list = couponbatchWapper.selectBybatchCode(batchCode1);
			changeuseconditionBean.setBatchId(list.get(0).getBatchId());
			changeuseconditionBean.setUseConditionType(2);
			changeuseconditionBean.setSellerId(sellercreatebatchBean.getSellerId());
			changeuseconditionBean.setProductIdList(pIdStrings);
			changeuseconditionCall.setData(changeuseconditionBean);
			changeuseconditionCall.callService();		
			Logger.verifyEquals("0", changeuseconditionCall.getString("statusCode"), "验证statusCode");
			
			VerifyDb(batchCode1,changeuseconditionBean);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_ChangeUseCondition_014() {
		Logger.start(true,"修改商家端优惠券使用条件,指定商品修改为全店通用成功-是否显示在首页 false");
		try {
			SellerCreateBatchBean sellercreatebatchBean = CouponShop2cnMCallService.setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCurrency("CNY");
			sellercreatebatchBean.setUseConditionType(2);
			List<String> pIdStrings=new ArrayList();
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			sellercreatebatchBean.setproductIdList(pIdStrings);

			String batchCode1 = CouponShop2cnMCallService.SellerCreateBatch(sellercreatebatchBean).getBatchCode();
			List<couponbatch> list = couponbatchWapper.selectBybatchCode(batchCode1);
			changeuseconditionBean.setBatchId(list.get(0).getBatchId());
			changeuseconditionBean.setUseConditionType(1);
			changeuseconditionBean.setSellerId(sellercreatebatchBean.getSellerId());
			changeuseconditionBean.setProductIdList(null);
			changeuseconditionBean.setIsShowInPage(false);
			changeuseconditionCall.setData(changeuseconditionBean);
			changeuseconditionCall.callService();		
			Logger.verifyEquals("0", changeuseconditionCall.getString("statusCode"), "验证statusCode");
			
			VerifyDb(batchCode1,changeuseconditionBean);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_ChangeUseCondition_015() {
		Logger.start(true,"修改商家端优惠券使用条件,指定商品修改为全店通用成功-是否显示在首页 true");
		try {
			SellerCreateBatchBean sellercreatebatchBean = CouponShop2cnMCallService.setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCurrency("CNY");
			sellercreatebatchBean.setUseConditionType(2);
			List<String> pIdStrings=new ArrayList();
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			pIdStrings.add("p"+TestDataManager.getRandomIntNum(5));
			sellercreatebatchBean.setproductIdList(pIdStrings);

			String batchCode1 = CouponShop2cnMCallService.SellerCreateBatch(sellercreatebatchBean).getBatchCode();
			List<couponbatch> list = couponbatchWapper.selectBybatchCode(batchCode1);
			changeuseconditionBean.setBatchId(list.get(0).getBatchId());
			changeuseconditionBean.setUseConditionType(1);
			changeuseconditionBean.setSellerId(sellercreatebatchBean.getSellerId());
			changeuseconditionBean.setProductIdList(null);
			changeuseconditionBean.setIsShowInPage(false);
			changeuseconditionCall.setData(changeuseconditionBean);
			changeuseconditionCall.callService();		
			Logger.verifyEquals("0", changeuseconditionCall.getString("statusCode"), "验证statusCode");
			
			VerifyDb(batchCode1,changeuseconditionBean);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}
